﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="productManager.ascx.cs" Inherits="TrangSucShop.administrator.AdminUsercontrol.productManager" %>
<script language="javascript" type="text/javascript"> 
   function PreviewImg(imgFile) 
      {         
//          var newPreview = document.getElementById("newPreview");        
//          newPreview.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = 'file://localhost/'+imgFile.value;
//          var img=document.createElement('img');
//         
//            
//          newPreview.style.width = "150px";        newPreview.style.height = "150px"; 

  
      }   
      function showLocalImage(img) 
      {
        imgname = img.value;
        imgname = imgname.replace(/\\/g,"/");
        content = "<img src=\"" + String(imgname) + "\" border=\"0\" height=\"150\" weight=\"150\">";
        eval('document.all("imagepreview").innerHTML=\" + content +"');
        document.all.imagepreview.style.visibility ='visible';
      }

Read more at TECK.IN: http://teck.in/javascript-to-preview-local-image.html#ixzz1gPsL3cM0
 
</script>

<asp:MultiView runat="server" ActiveViewIndex="0" ID="MT1">
<asp:View runat="server" ID="Manager">
 <table style="width:100%;">
 <tr>
 <th colspan="3" height="50" align="right">
            <img src="images/forms/icon_plus.gif" />
             <asp:HyperLink ID="HyperLink1" runat="server" 
                 NavigateUrl="../product.aspx?cm=insert">Thêm</asp:HyperLink>
             </th>
 </tr>
    <tr>
        <th colspan="3">
            <h1>Quản ly sản phẩm</h1> </th>
            
    </tr>
    <tr>
        
        <th colspan="3" height="50">
            <asp:Label ID="Label1" runat="server" Font-Italic="True" ForeColor="Red"></asp:Label>
        </th>
    </tr>
     <tr>
         <td align="center" colspan="3">
             <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                 AllowSorting="True" AutoGenerateColumns="False" BackColor="White" 
                 BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" 
                 DataKeyNames="ID" ForeColor="Black" GridLines="Vertical" 
                 onpageindexchanging="GridView1_PageIndexChanging" 
                 onrowcommand="GridView1_RowCommand" onrowdatabound="GridView1_RowDataBound" 
                 onrowediting="GridView1_RowEditing" onsorting="GridView1_Sorting" PageSize="8" 
                 ShowFooter="True" Width="100%">
                 <RowStyle BackColor="#F7F7DE" />
                 <Columns>
                     <asp:ImageField DataImageUrlField="Hinh" 
                         DataImageUrlFormatString="../../images/{0}" HeaderText="Hình"><ControlStyle Height="50px" Width="50px" /></asp:ImageField>
                     <asp:BoundField DataField="MaSanPham" HeaderText="Mã SP" 
                         SortExpression="MaSanPham" />
                     <asp:BoundField DataField="TenSanPham" HeaderText="Tên SP" 
                         SortExpression="TenSanPham" />
                     <asp:BoundField DataField="TenLoaiSanPham" HeaderText="Loại" />
                     <asp:BoundField DataField="SoLuong" HeaderText="Số lượng" />
                     <asp:BoundField DataField="GiaBan" HeaderText="Giá bán" />
                     <asp:CheckBoxField DataField="IsNew" HeaderText="SP mới" ReadOnly="True" />
                     <asp:TemplateField HeaderText="Sửa"><ItemTemplate><asp:LinkButton ID="LinkButton2" runat="server" 
                                 CommandArgument='<%# Eval("ID") %>' CommandName="Edit"> Sửa</asp:LinkButton></ItemTemplate><ControlStyle Width="100px" /><HeaderStyle Width="100px" /><ItemStyle HorizontalAlign="Center" Width="100px" /></asp:TemplateField>
                     <asp:TemplateField HeaderText="Xóa"><ItemTemplate><asp:LinkButton ID="LinkButton1" runat="server" 
                                 CommandArgument='<%# Eval("ID") %>' CommandName="Delete"> Xóa</asp:LinkButton></ItemTemplate><FooterTemplate><asp:LinkButton ID="linkThem" runat="server" CommandName="Insert" Text="Thêm"></asp:LinkButton></FooterTemplate><ControlStyle Width="100px" /><HeaderStyle Width="100px" /><ItemStyle HorizontalAlign="Center" Width="100px" /></asp:TemplateField>
                 </Columns>
                 <FooterStyle BackColor="#CCCC99" />
                 <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
                 <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
                 <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
                 <AlternatingRowStyle BackColor="White" />
             </asp:GridView>
         </td>
     </tr>
     <tr>
         <td>
             &nbsp;</td>
         <td>
             &nbsp;</td>
         <td>
             &nbsp;</td>
     </tr>
     </tr>
</table>
</asp:View>
<asp:View runat="server" ID="Edit">


    <table style="width:100%;">
        <tr>
            <th colspan="3"><h1>
                Thông Tin Sản Phẩm</h1>
                &nbsp;</th>
        </tr>
        <tr>
            <th colspan="3">
                <asp:Label ID="Label3" runat="server" Font-Italic="True" ForeColor="Red"></asp:Label>
            </th>
        </tr>
        <tr>
            <td width="100">
                Mã SP:</td>
            <td width="240">
                <asp:TextBox ID="TextBox1" runat="server" Width="200px"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                    ErrorMessage="(*)" ControlToValidate="TextBox1"></asp:RequiredFieldValidator>
                <asp:CheckBox ID="CheckBox1" runat="server" Text="SP mới" />
            </td>
            <td width="300px" rowspan="4">
            <table>
                <tr>
                    <td align="center" width="150">
                        &nbsp;</td>
                    <td align="center" width="150">
                        &nbsp;</td>
                </tr>
                <tr>
                    <td>
                        <div id="newPreview">
                    
                        </div>
                        <%--<div id="imagepreview"><img src="no-preview-image-name" /></div>--%>
                    </td>
                    <td>
                    &nbsp;</td>
                </tr>
            </table>
                
                
            </td>
        </tr>
        <tr>
            <td>
                Tên SP:</td>
            <td>
                <asp:TextBox ID="TextBox2" runat="server" Width="200px"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                    ControlToValidate="TextBox2" ErrorMessage="(*)"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                Loại SP:</td>
            <td>
                <asp:DropDownList ID="DropDownList1" runat="server" Width="200px">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td>
                Số Lượng:</td>
            <td>
                <asp:TextBox ID="TextBox4" runat="server" Width="200px"></asp:TextBox>
                <asp:RangeValidator ID="RangeValidator1" runat="server" 
                    ControlToValidate="TextBox4" ErrorMessage="số lượng phải là số" 
                    MaximumValue="99999999999" MinimumValue="0"></asp:RangeValidator>
            </td>
        </tr>
        <tr>
            <td>
                Giá bán:</td>
            <td>
                <asp:TextBox ID="TextBox5" runat="server" Width="200px"></asp:TextBox>
                <asp:RangeValidator ID="RangeValidator2" runat="server" 
                    ControlToValidate="TextBox5" ErrorMessage="giá bán phải là số" 
                    MaximumValue="99999999999" MinimumValue="0"></asp:RangeValidator>
            </td>
            <td>
              
                <asp:FileUpload ID="FileUpload1" runat="server" />
                <asp:Label ID="lbHinh" runat="server" Visible="False"></asp:Label>
                <asp:Label ID="lbID" runat="server" Visible="False"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                Mô Tả:</td>
            <td colspan="2">
                <asp:TextBox ID="TextBox9" runat="server" TextMode="MultiLine" Width="765px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
            <td>
                <asp:Button ID="Button1" runat="server"  Text="Lưu" Width="100px" 
                    onclick="Button1_Click" />
            </td>
        </tr>
    </table>


</asp:View>
</asp:MultiView>